package com.liveinstars.im.core.service;

import com.liveinstars.im.domain.dao.model.ChatGroupMember;
import com.liveinstars.im.entity.ChatMessage;
import com.liveinstars.im.common.exception.IMRuntimeException;

import java.util.List;

/**
 * @author: zhouze
 * @date: 2020/4/7
 */
public interface MessageService {

    /**
     * 发送消息接口
     * @param chatMessage
     * @throws IMRuntimeException
     */
    void sendMessage(ChatMessage chatMessage) throws IMRuntimeException;

    /**
     * 获取统一消息id
     * @return
     */
    Long getMsgId();

    /**
     * 获取所有离线消息
     * @param toId
     * @param fromMessageId
     * @return
     */
    List<ChatMessage> getAllOfflineChatMessageByToId(Long toId, Long fromMessageId);

    /**
     * 清除用户离线消息
     * @param userId
     */
    void clearALLChatMessageByToId(Long userId);

    /**
     * 保存message
     * @param message
     * @param saveCache
     * @param memberList
     * @return
     */
    ChatMessage saveChatMessage(ChatMessage message, Boolean saveCache, List<ChatGroupMember> memberList);
}
